package com.cafe.pro.controller;

import com.cafe.pro.dto.DecryptRequest;
import com.cafe.pro.dto.DecryptResponse;
import com.cafe.pro.dto.KeyChangeRequest;
import com.cafe.pro.service.SecurityService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/security")
@AllArgsConstructor
public class SecurityController {
    private final SecurityService securityService;

    @PostMapping("/decrypt")
    public String decrypt(@RequestBody DecryptRequest request) throws Exception {
        return securityService.decrypt(request);
    }

    @PostMapping("/change-key")
    public String changeKey(@RequestBody KeyChangeRequest request) throws Exception {
        return securityService.changeKey(request);
    }
}
